import { Body, Controller, Get, Param, Post, UseInterceptors } from '@nestjs/common';
import { FinanceService } from './finance.service';
import { ResInterceptor } from '../interceptor/res.interceptor';

@Controller('/finance')
@UseInterceptors(ResInterceptor)
export class FinanceController {
    constructor(private readonly financeService: FinanceService) {
    }

    // 获取新闻门户列表网站和api，动态生成
    @Get('/portals')
    getPortalList() {
        return [
            { name: '东方财富', api: '/east' },
            { name: '同花顺', api: '/tong' },
            { name: '新浪财经', api: '/sina' },
        ];
    }

    @Get('/east')
    async getEast() {
        const res = await this.financeService.getEast();
        return res;
    }

    @Get('/tong')
    async getTong() {
        const res = await this.financeService.getTong();
        return res;
    }

    @Get('/sina')
    async getSina() {
        const res = await this.financeService.getSina();
        return res;
    }
}
